package leetcode;
//2019蓝桥杯后缀表达式(不够完美，超出时间现限制)
import java.util.Arrays;
import java.util.Scanner;

public class Suffix {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int jia=sc.nextInt();
        int jian=sc.nextInt();
        int[]arr=new int[jia+jian+1];
        for (int i = 0; i < arr.length; i++) {
            arr[i]=sc.nextInt();
        }
        Arrays.sort(arr);
        long sum=calculation(arr,jia,jian);
        System.out.println(sum);
    }
    public static long calculation(int[]arr,int j,int z){   //将俩个减号看成一个加号减号为奇数时最后减去最小一个值
        int x=0,min=arr[0];
       if(arr[0]<0){//判断数据中是否含有减号
           x=1;
       }
        long sum=0;

        if(z==0||z%2==0){//看成一个减号与一个负值所以和为全部数相加
            for (int i = 0; i < arr.length; i++) {
                sum=sum+arr[i];
            }
            return sum;
        }
        if(z%2!=0&&x>0){

                for (int i = 0; i < arr.length; i++) {
                    if(arr[i]<0){
                        arr[i]=-arr[i];
                    }
                    sum=sum+arr[i];
                }
                return sum;


        }if(z%2!=0&&x==0){
            for (int i = 1; i < arr.length; i++) {
                sum=sum+arr[i];
            }return sum-arr[0];
        }

    return 0;
    }

}
